home *** CD-ROM | disk | FTP | other *** search
- Path: news.NetVision.net.il!news
- From: david_r@netvision.net.il
- Newsgroups: comp.lang.c
- Subject: [Q] decleration in header file, text in fwrite/read
- Date: Sun, 11 Feb 1996 22:12:49 GMT
- Organization: NetVision LTD.
- Message-ID: <4flq92$p1u@news.NetVision.net.il>
- Reply-To: david_r@netvision.net.il
- NNTP-Posting-Host: ts9dp4.netvision.net.il
- X-Newsreader: Forte Free Agent 1.0.82
-
-
- I need to store control file information in a readable text format.
- In order to use fread/fwrite, I have declared a special struct which
- includes space for the (constant) text headings. This struct gets the
- size needed for the headings by using sizeof on the heading strings.
-
- This is (cut to a minimum) what I'm using in a header file, which is
- the interface to the functions that handle the control file.
-
- ------------------begin bit from ctrl.h----------------------------
-
- char str_record_heading[] = "Record number: ";
- char str_EOL[] = "\r\n";
-
- typedef struct
- {
- char record_heading[ sizeof( str_record_heading) - 1]; /* room for
- heading */
- char record[4]; /* record
- number */
- char yasah_EOL[ sizeof( str_EOL) - 1];
- } FILE_CTRL_REC;
-
- -----------------------end bit-------------------------------------
-
- My problem is that when this is included in more that one file, I get
- an error about declaring the strings more than once. But I have to
- know the size of the strings for the declaration of FILE_CTRL_REC.
-
- How can I get it to compile?
-
- Also, any comments on making the readable control file in this fashion
- would be appreciated.
-
-
-
-
-
-